package com.demo.math.utils;

import cn.hutool.core.util.RandomUtil;

public class MathUtil {

    public static String equation(int flag, int limit) {
        int a = RandomUtil.randomInt(1, flag < 0 ? limit * 2 : limit);
        int b = RandomUtil.randomInt(limit);

        if (flag > 0) {
            return a + "+" + b;
        } else {

            if (a == b || a - b < 0) {
                return equation(flag, limit);
            } else {
                return a + "-" + b;
            }
        }
    }
}
